package com.lin.Service.Impl;

import com.lin.UserDao;
import com.lin.Service.UserService;
import com.lin.User;
import org.springframework.beans.factory.InitializingBean;

public class UserServiceImpl implements UserService, InitializingBean {
    private UserDao userDao;

    public UserServiceImpl(String name){
        System.out.println("有参构造器执行");
    }
    // setter注入
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
        System.out.println("beanFactory调用该方法获取UserDao: " + userDao);
    }

    @Override
    public User test() {
        return userDao.test();
    }

    public void init() {
        System.out.println("初始化方法");
    }

    public void destroy() {
        System.out.println("销毁方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet执行...");
    }
}
